/**
 * @Title:  AuthMechanismActivity.java 
 * @Copyright:  XXX Co., Ltd. Copyright YYYY-YYYY,  All rights reserved 
 * @Description:  TODO<请描述此文件是做什么的> 
 * @author:  MeiYi 
 * @data:  2016-1-5 上午11:24:06 
 * @version:  V1.0 
 */

package artid.com.arttogo.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.android.volley.VolleyError;

import artid.com.arttogo.R;
import artid.com.arttogo.app.ArtToGoApp;
import artid.com.arttogo.bean.InfoOrder;
import artid.com.arttogo.bean.MoneyPay;
import artid.com.arttogo.db.Cache;
import artid.com.arttogo.network.VolleyBasic;
import artid.com.arttogo.network.VolleyCallback;
import artid.com.arttogo.network.VolleyData;
import artid.com.arttogo.network.VolleyMap;

/**
 * TODO<请描述这个类是干什么的> 选择支付方式
 * 
 * @author 熊彬
 * @data: 2016-1-5 上午11:24:06
 * @version: V1.0
 */
public class PaySuccessActivity extends BaseActivity  {
	TextView name,address,phone,price;
	Button btnOrder;
	String id ="";
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_pay_succ);
		ArtToGoApp.getInstance().exitMall();
		mContext = PaySuccessActivity.this;
		//id = getIntent().getStringExtra("id");
        ChoicePayActivity.isNeedClose = true;
		mTittle = (TextView) findViewById(R.id.tittle_text);
		mTittle.setText("支付成功");
		mBack = (ImageView) findViewById(R.id.back_btn);
		mBack.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(PaySuccessActivity.this,ArtMallActivity.class);
				intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				startActivity(intent);
				finish();
			}
		});
		name = (TextView)findViewById(R.id.text_paysucc_name);
		price = (TextView)findViewById(R.id.text_paysucc_price);
		phone = (TextView)findViewById(R.id.text_paysucc_phone);
		address = (TextView)findViewById(R.id.text_paysucc_address);
		btnOrder = (Button)findViewById(R.id.btn_order);
		btnOrder.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(PaySuccessActivity.this,OrderDetActivity.class);
				intent.putExtra("id", ChoicePayActivity.id);
				startActivity(intent);
				finish();
				
			}
		});

		reqData(ChoicePayActivity.id);
	}

	public void onBackPressed() {
		super.onBackPressed();
		ArtToGoApp.getInstance().exitMall();
		
	};
	
	void reqData(String orderid){
		VolleyBasic.getInstance(PaySuccessActivity.this).post(Cache.infoOrder,
				VolleyMap.getInstance().infoOrder(orderid, "2"), InfoOrder.class,
				new VolleyCallback() {
					
					@Override
					public void onSuccess(VolleyData vd) {
						// TODO Auto-generated method stub
						 	final InfoOrder item = (InfoOrder)vd.getData();
							
							name.setText(item.getGoods_name());
							
							price.setText(item.getGoods_price());
							
							phone.setText(item.getMob_phone());
							address.setText(item.getAddress());
						
							return;
						
					}
					@Override
					public void onError(VolleyError volleyError) {
						// TODO Auto-generated method stub
						
					}
					});
	}



}
